package com.jiyun;

//import com.jiyun.third.utils.AlidayuUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * 文件名:SmsLoginLister
 * 创建者:W  j b
 * 创建时间:2022/5/26 19:51
 * 描述:这是一个实例
 */

/***
 * 发送短信登录验证码
 * **/
@Service
public class SmsLoginLister {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @RabbitListener(queues = "good")
    public void sendLoginCode(Message message, String phone){
        System.out.println("输入的是手机号"+phone);
//        AlidayuUtils alidayuUtils = new AlidayuUtils();
                stringRedisTemplate.boundValueOps(phone).set("556677");
                stringRedisTemplate.expire(phone,2, TimeUnit.MINUTES);
                System.out.println("短信发送成功");



    }
}
